<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>数组的sort方法</title>
	</head>
	<body>
		<script>
			var f=["Banana","Orange","Apple","Mango"];
			f.reverse();
			console.log(f);
			
			f.sort();
			console.log(f);
			
			var n=[3,21,51,60,7];
			n.sort(
				function(a,b){
					//返回的是a-b升序，返回b-a降序
					return a-b;
				}
				);
			console.log(n)
			
		</script>
	</body>
</html>
